//package cn.cttic.demo.controller;
//
//import java.io.File;
//import java.io.FileInputStream;
//import java.io.FileOutputStream;
//
//import com.alibaba.fastjson2.JSONObject;
//import org.apache.poi.xssf.usermodel.XSSFSheet;
//import org.apache.poi.xssf.usermodel.XSSFWorkbook;
//
///**
// * 导出excel文件增加水印
// *
// * @author Arien
// *
// */
//public class TestController {
//    /**
//     * 读取模板文件,当前例子文件放在WEB-INF/classes/下
//     *
//     * @return
//     * @throws Exception
//     */
//    public static FileInputStream createWorkbook() throws Exception {
////        cn.cttic.demo.controller.TestController downLoadUtil = new cn.cttic.demo.controller.TestController();
////        String filePath = downLoadUtil.getClass().getClassLoader()
////            .getResource("water.xlsx").getPath();
//        String filePath = "E:\\服务对账单.xlsx";
//        File finalXlsxFile = new File(filePath);
//        FileInputStream inputStream = new FileInputStream(finalXlsxFile);
//        return inputStream;
//    }
//
//    public static void main(String[] args) {
//
//        XSSFWorkbook wbook = null;
//        try {
//            wbook = new XSSFWorkbook(createWorkbook());
//
//            JSONObject jsonObject = JSONObject.parseObject("{\"id\":\"HX250105201000001\",\"company_id\":\"P2400020\",\"period_begin_date\":\"2024-12-01 00:00:00\",\"period_end_date\":\"2025-01-01 00:00:00\",\"order_type\":\"\\u5b89\\u88c5\",\"order_count\":1,\"reconciliation_status\":2,\"reconciliation_reason\":\"dsafadfdsafd\",\"starting_write_off\":null,\"write_off_reason\":\"dsafadfdsafd\",\"write_off_status\":3,\"write_off_approval_no\":\"123456\",\"write_off_proof\":\"https:\\/\\/setup.cttic-bd.com\\/oss\\/car-distribute\\/image\\/2025\\/01\\/10\\/f6b150e634004fee93a179223ebe6773.png\",\"has_receipt\":null,\"receipt_info\":\"https:\\/\\/setup.cttic-bd.com\\/oss\\/car-distribute\\/image\\/2025\\/01\\/11\\/90b7f8a9cb114e169089f66dd6243560.png\",\"paid_proof\":\"https:\\/\\/setup.cttic-bd.com\\/oss\\/car-distribute\\/image\\/2025\\/01\\/11\\/5d2b64173684440ea7b83fe96ac41c8c.png\",\"create_by\":null,\"create_time\":\"2025-01-05 20:10:28\",\"update_by\":null,\"update_time\":\"2025-01-05 20:10:28\",\"del_flag\":0,\"create_dept\":null,\"tenant_id\":\"000000\"}");
//
//            XSSFSheet wsheet = wbook.getSheetAt(0);
//            wsheet.getRow(2).getCell(1).setCellValue("添加上文件的路径");
//
//            //添加上文件的路径，组成文件的绝对路径
//            File file=new File("E:\\demo.xlsx");
//            FileOutputStream fileOutputStream=new FileOutputStream(file);
//            wbook.write(fileOutputStream);
//            //通过流的方式写入到文件中中
//            fileOutputStream.close();
//
//            ExcelToPdfUtil.excelToPdf(file.getPath(),"E:\\demo.pdf",".xlsx");
//            //使用完成之后要记得关闭这个流
//
////            title = title.substring(0, title.length() - 1);
////            title = new String(title.getBytes("gb2312"), "gbk");
////
//////            String[] titles = title.split(",");
//////            String fileName = new String(fileTitile.getBytes("gb2312"),
//////                "iso-8859-1");
//////            os = response.getOutputStream();
//////            response.reset();
//////            response.setHeader("Content-disposition", "attachment; filename="
//////                + fileName + ".xls");
//////            response.setContentType("application/msexcel;charset=utf-8");
//////            response.setCharacterEncoding("utf-8");
////
////            XSSFSheet wsheet = wbook.getSheetAt(0);
////            // 标题列
////            XSSFRow row0 = wsheet.createRow(0);
////            for (int i = 0; i < titles.length; ++i) {
////                wsheet.setDefaultColumnWidth(23);
////                XSSFCell cell = row0.createCell(i);
////                cell.setCellValue(titles[i]);
////            }
////
////            if ((list != null) && (!list.isEmpty())) {
////                for (int j = 0; j < list.size(); ++j) {
////                    Map<String, Object> obj = list.get(j);
////                    XSSFRow row = wsheet.createRow(j + 1);
////                    for (int i = 0; i < str.length; ++i) {
////                        XSSFCell cell = row.createCell(i);
////                        String name = str[i];
////                        String attr = String.valueOf(obj.get(name));
////                        if (("null".equals(attr)) || (StringUtil.isEmpty(attr)))
////                            attr = "";
////                        cell.setCellValue(attr);
////                    }
////
////                }
////
////            }
////
////            wbook.write(os);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//        } finally {
////            if (os != null)
////                try {
////                    os.close();
////                } catch (Exception e) {
////                    e.printStackTrace();
////                }
//        }
//    }
//}
